<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="common/head :: htmlhead">
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">添加博物馆</div>
                <div class="layui-card-body">
                    <form class="layui-form" action="" lay-filter="component-form-element">
                        <!--第一行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">工业博物馆名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="name" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第二行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">博物馆类别</label>
                                <div class="layui-input-block">
                                    <select name="museumtype" id="museumType"  lay-filter="museumType" lay-verify="required">
                                        <option value="综合类">综合类</option>
                                        <option value="行业类">行业类</option>
                                        <option value="企业类">企业类</option>
                                        <option value="高校及研究机构类">高校及研究机构类</option>
                                        <option value="其他个人或团体">其他个人或团体</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-lg6" id="jibie">
                                <label class="layui-form-label">级别</label>
                                <div class="layui-input-block">
                                    <select name="museumjibie" id="museumjibie" lay-verify="required">
                                        <option value="" selected></option>
                                        <option value="国家级">国家级</option>
                                        <option value="省级">省级</option>
                                        <option value="市级及以下">市级及以下</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--第三行area-picker-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6" id="area-picker">
                                <label class="layui-form-label">省市</label>
                                <div class="layui-input-inline layui-col-lg3">
                                    <select name="province" class="province-selector" lay-filter="province-1">
                                        <option value="">请选择省</option>
                                    </select>
                                </div>
                                <div class="layui-input-inline layui-col-lg3" >
                                    <select name="city" class="city-selector" lay-filter="city-1">
                                        <option value="">请选择市</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-lg4">
                                <label class="layui-form-label">详细地址</label>
                                <div class="layui-input-block">
                                    <input type="text" name="fulladdress" lay-verify="required" placeholder="填写市以后的地址"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第四行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">邮编</label>
                                <div class="layui-input-block">
                                    <input type="number" name="postcode" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第五行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">所属行业</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" readonly="readonly"type="text" name="industrytype" id="hangye" placeholder="按照《国民经济行业分类代码索引》填写，精确到中类（如：水泥、石灰和石膏制造业，则填写C301）"
                                           onkeyup="IndustrialClassification()" onclick="IndustrialClassification()" lay-verify="required">
                                    <input type="hidden" id="hangyetag" value="0">
                                </div>
                            </div>
                        </div>
                        <!--第六行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">联系人</label>
                                <div class="layui-input-block">
                                    <input type="text" name="linker" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">职务</label>
                                <div class="layui-input-block">
                                    <input type="text" name="linkerjob" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第七行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">手机</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mobilephone" lay-verify="required|phone" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">电话</label>
                                <div class="layui-input-block">
                                    <input type="text" name="phone" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第八行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">传真</label>
                                <div class="layui-input-block">
                                    <input type="text" name="fax" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">电子邮箱</label>
                                <div class="layui-input-block">
                                    <input type="text" name="email" lay-verify="required|email" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第九行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">法定代表人</label>
                                <div class="layui-input-block">
                                    <input type="text" name="faren" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">是否为独立法人</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isselffaren" value="1" title="是" checked="">
                                    <input type="radio" name="isselffaren" value="0" title="否">
                                </div>
                            </div>
                        </div>
                        <!--第十行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">统一社会信用代码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="creditcode" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">举办人</label>
                                <div class="layui-input-block">
                                    <input type="text" name="organizer" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十一行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">法人登记类型</label>
                                <div class="layui-input-block">
                                    <input type="text" name="farentype" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">法人登记机关</label>
                                <div class="layui-input-block">
                                    <input type="text" name="farenoffice" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十二行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">馆舍面积</label>
                                <div class="layui-input-block">
                                    <input type="number" name="buildingarea" lay-verify="required" placeholder="平方米"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">展示面积</label>
                                <div class="layui-input-block">
                                    <input type="number" name="showarea" lay-verify="required" placeholder="平方米"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十三行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">藏品数量</label>
                                <div class="layui-input-block">
                                    <input type="number" name="cangpinnum" lay-verify="required" placeholder="件"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">从业人数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="employeenum" lay-verify="required" placeholder="人"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十四行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">全年开放天数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="opendays" lay-verify="required" placeholder="天数"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">是否免费开放</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isfreeopen" value="1" title="是" checked="">
                                    <input type="radio" name="isfreeopen" value="0" title="否">
                                </div>
                            </div>
                        </div>
                        <!--第十五行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">上一年参观人次</label>
                                <div class="layui-input-block">
                                    <input type="number" name="vistornum" lay-verify="required" placeholder="万人次"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">上一年举办活动次数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="propagandanum" lay-verify="required" placeholder="次/年"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--单位简介-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">单位简介</label>
                                <div class="layui-input-block">
                                    <textarea name="unitintroduction" placeholder="500字以内" class="layui-textarea"></textarea>
                                </div>
                            </div>
                        </div>
                        <!--第十七行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">建立时间</label>
                                <div class="layui-input-block">
                                    <input type="text" name="founddate" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input" id="date1">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">主要观众类型</label>
                                <div class="layui-input-block">
                                    <select name="mainvistortype" lay-verify="required">
                                        <option value="0">政府人员</option>
                                        <option value="1">企业商务人员</option>
                                        <option value="2">科研调查人员</option>
                                        <option value="3">社会观众</option>
                                        <option value="4">其他人员</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--第十八行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">是否依托遗产原址</label>
                                <div class="layui-input-block">
                                    <select name="isdependlegency" lay-verify="required">
                                        <option value="0">是</option>
                                        <option value="1">否</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">产权归属方</label>
                                <div class="layui-input-block">
                                    <input type="text" name="propertyblong" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第十九行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">专职职工人数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="fulltimeemployeenum" lay-verify="required" placeholder="人"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">兼职职工人数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="parttimeemployeenum" lay-verify="required" placeholder="人"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第二十行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">高级职工人数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="seniorworkernum" lay-verify="required" placeholder="人"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">志愿者人数</label>
                                <div class="layui-input-block">
                                    <input type="number" name="volunteernum" lay-verify="required" placeholder="人"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第二十一行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">实际运营方</label>
                                <div class="layui-input-block">
                                    <input type="text" name="operator" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">归管管理部门</label>
                                <div class="layui-input-block">
                                    <input type="text" name="managedepart" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第二十二行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">馆舍建筑类型</label>
                                <div class="layui-input-block">
                                    <select name="constructtype" lay-verify="required">
                                        <option value="0">文物保护单位</option>
                                        <option value="1">当代建筑</option>
                                        <option value="2">近现代历史建筑</option>
                                        <option value="3">综合类及其他</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--第二十三行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">园区占地面积</label>
                                <div class="layui-input-block">
                                    <input type="number" name="parkarea" lay-verify="required" placeholder="平方米"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-col-lg6">
                                <label class="layui-form-label">库房面积</label>
                                <div class="layui-input-block">
                                    <input type="number" name="storeroomarea" lay-verify="required" placeholder="平方米"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第二十四行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">网站</label>
                                <div class="layui-input-block">
                                    <input type="text" name="website" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第二十五行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">近两年举办重大活动名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="activatename" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第二十六行：文件提交-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg3">
                                <label class="layui-form-label">博物馆资料(视频或图片)</label>
                                <div class="layui-input-block">
                                    <div class="layui-upload">
                                        <button type="button" class="layui-btn" id="filename">
                                            <i class="layui-icon">&#xe67c;</i>选择文件
                                        </button>
                                    </div>
                                    <p id="demoText"></p>
                                    <input type="hidden" name="fileid" id="fileid">
                                </div>
                            </div>
                        </div>
                        <!--第二十五行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">面临的困难和问题</label>
                                <div class="layui-input-block">
                                    <input type="text" name="problem" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--第二十五行-->
                        <div class="layui-row layui-col-space10 layui-form-item">
                            <div class="layui-col-lg10">
                                <label class="layui-form-label">建议及述求</label>
                                <div class="layui-input-block">
                                    <input type="text" name="advice" lay-verify="required" placeholder=""
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <!--提交&重置-->
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="aaa">提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.config({
        base: '/static/lib/' //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index', 'form','layarea'], function(){
        var $ = layui.$
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,layarea = layui.layarea
            ,form = layui.form;

        form.on('select(museumType)', function(data){
            var val=data.value;
            if(val=="综合类" || val=="行业类"){
                $("#jibie").show();
            }else{
                $("#jibie").hide();
                $('#museumjibie').val('无');
                layui.form.render('select');
            }
        });

        layarea.render({
            elem: '#area-picker',
            change: function (res) {
                //选择结果
                console.log(res);
            }
        });

        form.render(null, 'component-form-element');
        element.render('breadcrumb', 'breadcrumb');

        form.on('submit(aaa)', function(data){
            $.ajax({
                url:"/submitbwg",
                async: false,
                type:"POST",
                dataType: "text",
                data:data.field,
                success: function(data){
                    if(data==="success_bwg"){
                        layer.open({
                            title: '提交成功'
                            ,content: '博物馆会员已添加！'
                            ,yes: function(index, layero){
                                parent.layui.admin.events.closeThisTabs();
                                top.layui.index.openTabsPage("/datashow/bwg","博物馆信息");
                            }
                        });
                    }
                }
            });
            return false;
        });
    });
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#date1'//指定元素
            ,format:'yyyy/MM/dd'
        });
        laydate.render({
            elem: '#date2' //指定元素
            ,format:'yyyy/MM/dd'
        });
    });

    layui.use('upload', function(){
        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#filename' //绑定元素
            ,url: '/uploadbwg' //上传接口
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }
                //上传成功
                var demoText = $('#demoText');
                demoText.html('<span style="color: #4cae4c;">'+res.originalName+'</span>');
                var fileid  = $('#fileid');
                fileid.attr("value",res.fileid);
                //上传完毕回调
            }
            ,error: function(){
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
                //请求异常回调
            }
        });
    });
</script>
<script type="text/javascript" src="/static/js/hangye.js"></script>
</body>
</html>